package com.ryhx.ssm.controller;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
import org.apache.log4j.Logger;
import com.ryhx.ssm.domain.UserT;
import com.ryhx.ssm.utils.StringUtils;

@SuppressWarnings("all")
public class WebConfigContextListener implements ServletContextListener,HttpSessionAttributeListener{
	private static Logger logger=Logger.getLogger(WebConfigContextListener.class);
	public void contextDestroyed(ServletContextEvent event) {
		
	}
	@SuppressWarnings("all")
	private void setWebConfig(ServletContext context){
		context.setAttribute("webroot", context.getContextPath());
	}
	/*public UserT getSessionUser(HttpSessionBindingEvent event){
		if(StringUtils.isNull(event.getName()).equals("session_user")){
        	Object obj=event.getValue();
        	if(obj!=null){
        		return (UserT)obj;
        	}
        }
		return null;
	}*/
	public void attributeAdded(HttpSessionBindingEvent event) {
	}
	public void attributeRemoved(HttpSessionBindingEvent event) {
	}
	public void attributeReplaced(HttpSessionBindingEvent event) {
		
	}
	public void contextInitialized(ServletContextEvent event) {
		ServletContext context=event.getServletContext();
		setWebConfig(context);
	}	
}
